package paper.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;

import paper.action.form.PaperActionForm;
import paper.service.PaperCRUDService;

public class PaperDAOAction extends DispatchAction{
	private PaperCRUDService service;
	
	public void setService(PaperCRUDService service){
		this.service = service;
	}
	
	public ActionForward insertPaper(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response){
		PaperActionForm paperForm = (PaperActionForm)form;
		System.out.println("actionForm"+paperForm);
		String result="fail";
		result = service.insertPaper(paperForm);
		request.setAttribute("paperForm", paperForm);
		return mapping.findForward(result);
	}
	
}
